<div class="d-flex align-items-center">
    <h5 class="mb-0 d-flex align-items-center gap-2">
        <span><i class="fas fa-list me-2"></i>资产列表</span>
        {% if page_obj %}
            <span class="badge bg-secondary">
                <i class="fas fa-database me-1"></i>{{ page_obj.paginator.count }} 个资产
            </span>
        {% endif %}
    </h5>
    <div class="ms-auto d-flex align-items-center gap-2">
        <form method="get" class="d-flex align-items-center gap-2" id="perPageForm">
            {# 保留当前筛选条件 #}
            <input type="hidden" name="page" value="1">
            {% if search_query %}<input type="hidden" name="search" value="{{ search_query }}">{% endif %}
            {% if request.GET.category %}<input type="hidden" name="category" value="{{ request.GET.category }}">{% endif %}
            {% if request.GET.organization %}<input type="hidden" name="organization" value="{{ request.GET.organization }}">{% endif %}
            {% if request.GET.status %}<input type="hidden" name="status" value="{{ request.GET.status }}">{% endif %}
            {% if request.GET.department %}<input type="hidden" name="department" value="{{ request.GET.department }}">{% endif %}
            {% if request.GET.user %}<input type="hidden" name="user" value="{{ request.GET.user }}">{% endif %}
            {% if sort %}<input type="hidden" name="sort" value="{{ sort }}">{% endif %}
            {% if order %}<input type="hidden" name="order" value="{{ order }}">{% endif %}

            <label for="perPageSelect" class="text-muted small">每页</label>
            <select class="form-select form-select-sm" name="per_page" id="perPageSelect" onchange="this.form.submit()" style="width:auto;">
                <option value="10" {% if per_page == 10 %}selected{% endif %}>10</option>
                <option value="20" {% if per_page == 20 %}selected{% endif %}>20</option>
                <option value="50" {% if per_page == 50 %}selected{% endif %}>50</option>
                <option value="100" {% if per_page == 100 %}selected{% endif %}>100</option>
            </select>
            <span class="text-muted small">行</span>
        </form>
    </div>
</div>
